<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">
    <link rel="stylesheet" href="__PUBLIC__/static/css/style.css">
    <link rel="icon" href="__PUBLIC__/static/image/code.png">
</head>
<body class="body">

<div class="system-table01">

<form class="layui-form" action="{:url('admin/webconfig/edit','action='.\Request::action())}" method="post" id="editform">
    <table class="layui-table">
      <colgroup>
        <col width="20%">
        <col width="50%">
        <col>
        </colgroup>
        <thead>
          <tr>
            <th style="text-align: right">参数说明</th>
            <th align="center">参数值</th>
            <th align="center">变量名</th>
          </tr>
        </thead>
        <tbody>
          {foreach $data as $key=>$vo} 
          <tr>
            <td align="right">{$vo.name}</td>
            <td>    
    {if $vo.type == 0}
      {:createform('id-'.$vo.id.'-'.$vo.varname, $vo.value, 0, $vo.typeval)}
    {elseif $vo.type == 1 /}
      {:createform('id-'.$vo.id.'-'.$vo.varname, $vo.value, 1, $vo.typeval)}
    {elseif $vo.type == 2 /}
      {:createform('id-'.$vo.id.'-'.$vo.varname, $vo.value, 2, $vo.typeval)}
    {elseif $vo.type == 3 /}
      {:createform('id-'.$vo.id.'-'.$vo.varname, $vo.value, 3, $vo.typeval)}
    {elseif $vo.type == 4 /}
      {:createform('id-'.$vo.id.'-'.$vo.varname, $vo.value, 4, $vo.typeval)}
    {/if}
  </td>
            <td>{$vo.varname}：{$vo.info}</td>
          </tr>
          {/foreach}
        </tbody>
    </table>
    <div class="layui-form-item" style="text-align: right;">
      <div class="layui-input-block">
        <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="demo1">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>
    </div>
    <div class="layui-col-md3"><a class="layui-btn site-demo-active layui-btn-sm layui-btn-primary" data-type="tabAdd" id="addwebconfig" data-href="{:url('admin/Webconfig/add')}">添加系统配置数据</a></div>
  </form>
</div>

<!-- 通用-970*90 -->
<script src="__PUBLIC__/layui/layui.js" charset="utf-8"></script>
<script src="__ADMIN__/js/comm.js" charset="utf-8"></script>
<script type="text/javascript">
layui.use(['form', 'table'], function() {
    var $ = layui.jquery,
        form = layui.form,
        table = layui.table;
    $('#addwebconfig').click(function() {
      href = $(this).attr('data-href');
      layer.alert('止配制为程序人员添加，请确定后再添加',function(index){
          layer.open({
            type: 2,
            area: ['700px', '650px'],
            fixed: false, //不固定
            maxmin: true,
            content: href
        });
        layer.close(index);
      });
    })
    
      form.on('submit(demo1)', function(data){
        $.post($('#editform').attr('action'),$("#editform").serialize(),function(data) {
                if (data.code == 1) {
                    layer.alert(data.msg,function(){
                      window.location.reload(true); 
                    });
                }
            });
        return false;
      });


});
</script>
</body>
</html>